--- leptonica-1.68.org/src/makefile.static	2014-08-14 20:49:30.514544651 +0200
+++ leptonica-1.68/src/makefile.static	2014-08-14 20:52:26.008544928 +0200
@@ -97,15 +97,15 @@
 #        ERROR_* logging, and to remove all DEBUG information dependent
 #        on whether or not NO_CONSOLE_IO has been defined.
 #     - remove -fPIC for Cygwin
-CC =		gcc -ansi -D_BSD_SOURCE -DANSI -fPIC
-#CC =		gcc -ansi -D_BSD_SOURCE -DANSI -Werror -fPIC
-#CC =		g++ -D_BSD_SOURCE -fPIC
-#CC =		g++ -Wunused -D_BSD_SOURCE -fPIC
-#CC =		gcc -ansi -DNO_CONSOLE_IO -D_BSD_SOURCE -DANSI -fPIC
-#CC =		gcc -ansi -D_BSD_SOURCE -DANSI
+#CC =		gcc -ansi -D_BSD_SOURCE -DANSI -fPIC
+##CC =		gcc -ansi -D_BSD_SOURCE -DANSI -Werror -fPIC
+##CC =		g++ -D_BSD_SOURCE -fPIC
+##CC =		g++ -Wunused -D_BSD_SOURCE -fPIC
+##CC =		gcc -ansi -DNO_CONSOLE_IO -D_BSD_SOURCE -DANSI -fPIC
+##CC =		gcc -ansi -D_BSD_SOURCE -DANSI
 
 #   Test for processor endianness (valid with gnu make only)
-ENDIANNESS := $(shell $(CC) -o endiantest endiantest.c; ./endiantest; rm -f endiantest)
+ENDIANNESS := $(shell echo __BYTE_ORDER | $(CC) -include endian.h -E - | tail -n 1 | sed -e s/1234/L_LITTLE_ENDIAN/ -e s/4321/L_BIG_ENDIAN/)
 
 # Conditional compilation (depending on processor endianness)
 CPPFLAGS =      $(INCLUDES) -D$(ENDIANNESS)
@@ -168,7 +168,7 @@
 		finditalic.c flipdetect.c fliphmtgen.c \
 		fmorphauto.c fmorphgen.1.c fmorphgenlow.1.c \
 		fpix1.c fpix2.c \
-		gifio.c gifiostub.c gplot.c graphics.c \
+		gifio.c  gplot.c graphics.c \
 		graymorph.c graymorphlow.c \
 		grayquant.c grayquantlow.c heap.c \
 		jbclass.c jpegio.c jpegiostub.c \
